<template>
    <view>
        <View class="topTitle" v-if="type === 1">请光脚站在体脂秤上</View>
        <View class="topTitle" v-if="type === 2">请勿离开秤哦</View>
        <View class="topTitle" v-if="type === 3">未能检查到测量数据 </br>请检查设备绑定状态及连接状态</View>
        <image style="width: 100%; height: 334px" src="https://admin.ximusen.cn/profile/upload/ximusen_mini_app_img/fother.png"> </image>
        <View class="listName" style="margin-bottom: 10px" v-if="type == 1">请确保双脚紧贴（或秤上两边的电极片）</View>
        <View class="listName" v-if="type == 1">体脂称弱电流可能对孕妇身体有影响，</View>
        <View class="listName" v-if="type == 1"> 建议孕妇穿鞋袜测量体重即可…</View>
        <View class="listCenter">
            <image style="width: 56px; height: 56px" v-if="type === 2" src="https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/allOneShow.png">
            </image>
            <image style="width: 56px; height: 56px" v-if="type === 3" src="https://smosun-minapp.oss-cn-shanghai.aliyuncs.com/weapp/img/showYas.png">
            </image>
        </View>
        <View v-if="type === 2" class="foterTxt">测量中...</View>
        <View class="listCenter">
        <View v-if="type === 3" class="foterTxts" @click="changeType">再试一下</View>
        </View>
    </view>
</template>

<script>
import { mapState, mapMutations } from "vuex";

export default {
    data() {
        return {
            type: 1,
            change:''
        };
    },
    computed: {
        ...mapState(["userInfo"]),
    },
    methods: {

        changeType() {
            this.type = 1
            this.changeTime()
        },
        changeTime() {
            setTimeout(() => {
            if (!this.change) {
                this.type=2
            }

        }, 3000)
        setTimeout(() => {
            if (!this.change) {
                this.type=3
            }

        },60000)
        }
    },
    onLoad() {
        this.changeTime()
        uni.$on("update", function (data) {
            if (data.getWeight && data.getWeight) {
                console.log('接收消息成功')
                uni.navigateBack({ delta: 1 });
            }
        });


    }
};
</script>

<style lang="less" scoped>
.topTitle {
    margin-top: 120px;
    text-align: center;
    height: 25px;
    font-size: 18px;
    font-weight: 500;
    color: #333333;
    line-height: 25px;
}
.listName {
    height: 20px;
    font-size: 14px;
    font-weight: 400;
    color: #418170;
    line-height: 20px;
    text-align: center;
}
.listCenter {
    display: flex;
    justify-content: center;
}
.foterTxt {
    height: 22px;
    font-size: 16px;
    text-align: center;
    font-weight: 400;
    color: #418170;
    line-height: 22px;
    margin-top: 17px;
}
.foterTxts {
    width: 164px;
height: 48px;
border-radius: 12px;
border: 1px solid #418170;
font-size: 15px;
font-weight: 600;
color: #418170;
line-height: 48px;
text-align: center;
margin-top: 20px;
}
</style>
